The present invention relates to code generation, and in particular, to systems and methods for tracing code generation in template engines.
As technology progresses, computer systems have taken on more duties than ever before. For example, computer systems control the behavior of everyday devices such as mobile phones, automobiles, and various government networks that we depend on. This has led to an increasing demand for properly designed, bug-free software.
Generally speaking, software programs are developed by a computer programmer writing source code in a specific language. This source code is written to perform a specific action. Depending on the task at hand, the length of the source code may range from a few lines to hundreds of pages. In some instances, the source code may span over multiple files. In FIG. 1, source code 110 is received by compiler 120. As shown, source code 110 has been broken into multiple files. Compilers receive source code in a specific language and compile the code into an executable to be interpreted as a program by a computer. Therefore, compilers serve as a bridge between source code that is easily understood by programmers and space-efficient executable binaries that are understood by computers. After receiving all the files, compiler 120 converts the source code into executable 130. This executable may then be received as an input to a computer system.
In the software development model illustrated in FIG. 1, the programmer is responsible for both the technical and creative aspects required in developing a computer program. One common way to alleviate this burden on the programmer is by introducing template engines. A template engine increases the level of abstraction in the software development model by allowing the application to be developed apart from the formalities of the source code. In FIG. 2, template engine 230 receives template 210 along with model 220 and generates generated code 240. Template 210 describes the formalities of generated code 240 while model 220 describes the behavior. Similar to code 110 in FIG. 1, generated code 240 may be received by a compiler and converted into an executable.
The use of template engines allows software development to be separated based on skill-set. For example, programmers with a high degree of creativity may develop the models while programmers with in depth knowledge of the programming language may develop the templates. Furthermore, template engines enhance productivity by reducing unnecessary reproduction of effort. However, debugging the templates and models can be extremely difficult with existing technology. The source of problems in generated code are difficult to discover because after generating the code, it is impossible to determine the portions of the template and model that went into generating a piece of code. While mechanisms for debugging generated code do exist, they are often very cumbersome and include the strenuous exercise of stepping through a debugger.
Thus, there is a need for the ability to trace code generation in template engines. The present invention solves these and other problems by providing systems and methods of tracing code generation in template engines.